﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Mimoza.GUI;
using Mimoza.ObjectLayer;
using Mimoza.SystemPlugin;

namespace SetupWiz
{
    public partial class MimozaServer : UserControl, Mimoza.GUI.IWizardPage
    {
        public Policy Policy
        {
            get
            {
                Policy policy = new Policy(null);
                SystemPluginData data = new SystemPluginData();
                data.ShownShortcutBitMask = ShortcutBitmask.MyComputer | ShortcutBitmask.RecycleBin | ShortcutBitmask.InternetExplorer | ShortcutBitmask.DefaultRDP;

                if (this.radioButton1.Checked)
                {
                    data.IsServiceDisable = true;
                }
                else if (this.radioButton2.Checked)
                { 
                    //data.
                }
                else 
                {
                    data.NewServiceAddress = this.textBox1.Text;
                }

                policy.Data = data.Serialize();
                return policy;
            }
        }
        #region IWizardPage Members
        private IWizard m_wizard;

        private bool m_IsConfigured = false;

        public void Init(Mimoza.GUI.IWizard wizard)
        {
            m_wizard = wizard;
        }

        public void EnterPage()
        {
        }

        public bool Try2LeavePage(Mimoza.GUI.WizardPageLeavingDirection direction)
        {
            m_IsConfigured = true;
            return true;
        }

        public Mimoza.GUI.IWizard Wizard
        {
            get
            {
                return m_wizard;
            }
        }

        public string PageName
        {
            get { return Resource.ManagmentServer_PageName; }
        }

        public string PageTitle
        {
            get { return Resource.ManagementServer_PageTitle; }
        }

        public bool IsConfigured
        {
            get
            {
                return m_IsConfigured;
            }
            set
            {
                m_IsConfigured = value;
            }
        }

        public event Mimoza.GUI.PageEvent OnPageModified;

        #endregion

        public MimozaServer()
        {
            InitializeComponent();
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            this.textBox1.Enabled = this.radioButton3.Checked;
        }
    }
}
